
call setenv 2>NUL

if ""%1""=="""" goto doneSetArgs
set CATALINA_HOME=%1
shift
if ""%1""=="""" goto doneSetArgs
set WAR_APP=%1
shift
:doneSetArgs

if exist "%CATALINA_HOME%\bin\catalina.bat" goto ok1
echo The CATALINA_HOME environment variable is not defined correctly
pause
goto end

:ok1
if not ""%WAR_APP%""=="""" goto ok2
echo The WAR_APP environment variable is not defined
pause
goto end

:ok2
set CUR_DIR=%CD%

set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
echo %EXECUTABLE%
cd /d "%CATALINA_HOME%\bin"
call "%EXECUTABLE%" run
@echo on
call "%CUR_DIR%\tomcatclean.cmd" %CATALINA_HOME% %WAR_APP%

:end
